package Strategy;

import java.util.Arrays;

/**
 * @ProjectName: 23种设计模式
 * @Package: Strategy
 * @ClassName: Main
 * @Author: renhan
 * @Description:
 * @Date: 2020/11/10 16:44
 * @Version: 1.0
 */
public class Main {

    public static void main(String[] args){
        Cat[] a = {new Cat(2,2),new Cat(3,5),new Cat(1,1)};
//        new Sorter<Cat>().sort(a, new CatComparator().compare());
        new Sorter<Cat>().sort(a,((o1, o2) -> {
            if(o1.height > o2.height) {
                return 1;
            } else if (o1.height < o2.height) {
                return -1;
            }
            return 0;
        }));
        System.out.println(Arrays.toString(a));
    }

}
